Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiIcon] Upgrade svgr/svgo dependencies to latest #6843

Merged
merged 5 commits into from
Jun 20, 2023

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Jun 14, 2023

Summary

This PR:

  • Upgrades all our @svgr/ dependencies to latest (which puts us at using SVGO v3, up from v1)
  • Updates our svgr config/API calls to latest (see https://react-svgr.com/docs/migrate)
  • Removes the need for manual prettier CLI command by using @svgr/plugin-prettier - removed this addition, as the plugin's Prettier settings didn't match up with our own for whatever reason
  • Re-runs yarn compile-icons, which changes some SVG output/optimization slightly due to SVGO upgrade

QA

  • Go to the icons docs pages
  • Confirm that no icons look broken
  • Confirm all icons (esp logos and apps) flip as expected in dark mode

General checklist

  • Checked in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

Copy link
Contributor Author

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving a couple comments for reference

"@svgr/core": "5.5.0",
"@svgr/plugin-svgo": "^4.0.3",
"@svgr/core": "8.0.0",
"@svgr/plugin-jsx": "^8.0.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @svgr/plugin-jsx dependency needs to be manually listed now as it's no longer bundled in @svgr/core as of https://github.com/gregberge/svgr/releases/tag/v7.0.0

@@ -1,10 +1,9 @@
const glob = require('glob');
const svgr = require('@svgr/core').default;
const svgr = require('@svgr/core').transform;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +5 to +6
const license =
require('../.eslintrc.js').rules['local/require-license-header'][1].license;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was Prettier autolinting this file on save

Comment on lines 59 to +60
template: (
{ template },
opts,
{ imports, interfaces, componentName, props, jsx }
{ imports, interfaces, componentName, props, jsx },
{ tpl }
) =>
hasIds
? template.ast`
? tpl`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 41 to +47
svgoConfig: {
plugins: [
{ cleanupIDs: true },
{ prefixIds: false },
{ removeViewBox: false },
{ removeUselessStrokeAndFill: false },
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false,
removeUselessStrokeAndFill: false,
},
},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see https://github.com/svg/svgo/releases/tag/v2.0.0 config changes. Also see SVGO's default preset docs and their plugins table - cleanupIDs is now listed as automatically present, so no need to override it, and prefixIds is listed as not being automatically present, so no need to disable it

@cee-chen
Copy link
Contributor Author

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6843/

Copy link
Contributor

@1Copenut 1Copenut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I looked through the adjusted icons, downloaded your branch, and ran yarn compile-icons and yarn-lint.

Two of the icons threw errors on first lint:

  • src/components/icon/assets/logo_memcached.tsx
  • src/components/icon/assets/logo_php.tsx

Running yarn-lint-fix updated those two icons and the second lint run passed 100%.

@1Copenut
Copy link
Contributor

Jenkins test this

1 similar comment
@1Copenut
Copy link
Contributor

Jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6843/

@cee-chen cee-chen force-pushed the chore/svgr-upgrades branch from a2f6457 to b4ea529 Compare June 19, 2023 04:07
@cee-chen cee-chen force-pushed the chore/svgr-upgrades branch from 8331356 to 53a80e1 Compare June 19, 2023 04:29
@cee-chen cee-chen marked this pull request as ready for review June 19, 2023 04:31
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6843/

interface SVGRProps {
title?: string;
titleId?: string;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this note for my own edification - the newline removal actually doesn't have anything to do with this upgrade/PR or with the recent Node v18 upgrade. It occurred due to our recent babel upgrades, and is a known issue: gregberge/svgr#809

Since this doesn't affect any actual consumer or user experience due to it being generated code, I think we can safely ignore it for now.

@cee-chen cee-chen enabled auto-merge (squash) June 19, 2023 05:21
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6843/

@1Copenut
Copy link
Contributor

Jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6843/

@cee-chen cee-chen merged commit 4fab267 into elastic:main Jun 20, 2023
@cee-chen cee-chen deleted the chore/svgr-upgrades branch June 20, 2023 13:51
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6843/

Ikuni17 pushed a commit to elastic/kibana that referenced this pull request Jul 6, 2023
`[email protected]` ⏩ `83.0.0`

⚠️ The biggest change in this PR by far is the `EuiButtonEmpty` Emotion
conversion, which changes the DOM structure of the button slightly as
well as several CSS classes around it.

EUI has attempted to convert any custom EuiButtonEmpty CSS overrides
where possible, but would super appreciate it if CODEOWNERS checked
their touched files. If anything other than a snapshot or test was
touched, please double check the display of your button(s) and confirm
everything still looks shipshape. Feel free to ping us for advice if
not.

---

## [`83.0.0`](https://github.com/elastic/eui/tree/v83.0.0)

**Bug fixes**

- Fixed `EuiPaginationButton` styling affected by `EuiButtonEmpty`'s
Emotion conversion ([#6893](elastic/eui#6893))

**Breaking changes**

- Removed `isPlaceholder` prop from `EuiPaginationButton`
([#6893](elastic/eui#6893))

## [`82.2.1`](https://github.com/elastic/eui/tree/v82.2.1)

- Updated supported Node engine versions to allow Node 16, 18 and >=20
([#6884](elastic/eui#6884))

## [`82.2.0`](https://github.com/elastic/eui/tree/v82.2.0)

- Updated EUI's SVG icons library to use latest SVGO v3 optimization
([#6843](elastic/eui#6843))
- Added success color `EuiNotificationBadge`
([#6864](elastic/eui#6864))
- Added `badgeColor` prop to `EuiFilterButton`
([#6864](elastic/eui#6864))
- Updated `EuiBadge` to use CSS-in-JS for named colors instead of inline
styles. Custom colors will still use inline styles.
([#6864](elastic/eui#6864))

**CSS-in-JS conversions**

- Converted `EuiButtonGroup` and `EuiButtonGroupButton` to Emotion
([#6841](elastic/eui#6841))
- Converted `EuiButtonIcon` to Emotion
([#6844](elastic/eui#6844))
- Converted `EuiButtonEmpty` to Emotion
([#6863](elastic/eui#6863))
- Converted `EuiCollapsibleNav` and `EuiCollapsibleNavGroup` to Emotion
([#6865](elastic/eui#6865))
- Removed Sass variables `$euiCollapsibleNavGroupLightBackgroundColor`,
`$euiCollapsibleNavGroupDarkBackgroundColor`, and
`$euiCollapsibleNavGroupDarkHighContrastColor`
([#6865](elastic/eui#6865))

---------

Co-authored-by: Cee Chen <[email protected]>
Co-authored-by: Jeramy Soucy <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants